package org.taobao.lxw.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;
import org.taobao.dq.dao.BaseDao;
import org.taobao.lxw.bean.Comments;
import org.taobao.lxw.dao.ICommentDao;
import org.taobao.lxw.mapper.ICommentMapper;

@Repository
public class CommentDao extends BaseDao implements ICommentDao {

	@Override
	public Integer getCommentsCountBySid(Integer sid) {
		return getMapper(ICommentMapper.class).getCommentsCountBySid(sid);
	}

	@Override
	public List<Comments> getAllCommentPageById(Integer sid, Integer pageIndex, Integer pageSize) {
		return getMapper(ICommentMapper.class).getAllCommentPageById(sid, (pageIndex-1)*pageSize, pageIndex*pageSize);
	}

	@Override
	public Comments getCommentById(Integer id) {
		return getMapper(ICommentMapper.class).getCommentById(id);
	}

	@Override
	public List<Comments> getCommentsByName(Integer sid,String name) {
		return getMapper(ICommentMapper.class).getCommentsByName(sid,name);
	}

	@Override
	public List<Comments> getCommentByOid(Integer oid) {
		return getMapper(ICommentMapper.class).getCommentByOid(oid);
	}

	@Override
	public Comments getCommentByIdAndSid(Integer id, Integer sid) {
		return getMapper(ICommentMapper.class).getCommentByIdAndSid(id, sid);
	}

}
